// pages/admin/my/my.js
let app = getApp()
Page({
  data: {
    active:3,
    userInfo: '',
    hagnjia:'',
    daipeisong:'',
    wancheng:'',
    img: "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif?imageView2/1/w/80/h/80",
  },
//跳转
  onChange(event) {
    if (event.detail == "0") {
      wx.redirectTo({
        url: '../index',
      })
    } else if (event.detail == "1") {
      wx.redirectTo({
        url: '../Goodslist/index',
      })
    } else if (event.detail == "2") {
      wx.redirectTo({
        url: '../order/order',
      })
    }
  },
  onLoad(){
    app.api.getData('admin/order','none',(res) => {
      let daipeisong = res.data.filter(item=>{
        return item.a_status == '待配送'
      })
      .length
      let wancheng = res.data.filter(item=>{
        return item.a_status == '配送完毕'
      })
      .length
      this.setData({
        daipeisong:daipeisong,
        wancheng:wancheng,
        userInfo: wx.getStorageSync('userInfo') ? JSON.parse(wx.getStorageSync('userInfo')) : '',
        shangjia:app.globalData.goodsListNumber
      })
    })
  }
})